<?php

namespace app\store\model;

use think\Model;

class SystemConfig extends Model
{
    protected $name = 'system_config';

    // 定义主键
    protected $pk = 'store_id';

    /**
     * 查询
     * @param string $field 查询字段
     * @param array|string $where 条件
     */
    public static function getList(String $field, $where = []): array
    {
        return self::field($field)->where($where)->select()->toArray();
    }

    /**
     * 数量查询
     * @param array|string $where 条件
     * @return int
     */
    public static function getCount($where): int
    {
        return self::where($where)->count();
    }

    // 查询数据
    public static function getKeys(string $key){
        return self::where(['key'=>$key])->value('value');
    }
}
